package com.corx.network.core.storage;

import com.corx.network.core.model.ReceivedMessage;
import lombok.extern.slf4j.Slf4j;

/**
 * @author gx
 * @version 1.0.0
 */
@Slf4j
public abstract class AbstractStorage implements Storage {


    @Override
    public void doHandler(ReceivedMessage message) {

        if (message == null || message.getDeviceId() == null || message.getDeviceId().isEmpty()) {
            log.warn("ReceivedMessage.deviceId不存在，return不做任何处理，ReceivedMessage = {}", message == null ? "null" : message.toString());
            return;
        }

        doSaveReceivedMessage(message);

    }

    public abstract void doSaveReceivedMessage(ReceivedMessage message);


}

